<template>
  <div>
    <el-row :gutter="40" class="panel-group">
      <el-col :xs="6" :sm="6" :lg="3" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('System')">
          <div class="card-panel-icon-wrapper icon-setting">
            <svg-icon icon-class="setting" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">系统管理</div>
          </div>
        </div>
      </el-col>
      <el-col :xs="6" :sm="6" :lg="3" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('Purchase')">
          <div class="card-panel-icon-wrapper icon-purchase">
            <svg-icon icon-class="purchase" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">采购管理</div>
          </div>
        </div>
      </el-col>
      <el-col :xs="6" :sm="6" :lg="3" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('purchases')">
          <div class="card-panel-icon-wrapper icon-stock">
            <svg-icon icon-class="stock" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">库存管理</div>
          </div>
        </div>
      </el-col>
      <el-col :xs="6" :sm="6" :lg="3" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('shoppings')">
          <div class="card-panel-icon-wrapper icon-breed">
            <svg-icon icon-class="breed" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">养殖管理</div>
          </div>
        </div>
      </el-col>
      <el-col :xs="6" :sm="6" :lg="3" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('shoppings')">
          <div class="card-panel-icon-wrapper icon-sales">
            <svg-icon icon-class="sales" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">销售管理</div>
          </div>
        </div>
      </el-col>
      <el-col :xs="6" :sm="6" :lg="3" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('shoppings')">
          <div class="card-panel-icon-wrapper icon-teller">
            <svg-icon icon-class="teller" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">出纳管理</div>
          </div>
        </div>
      </el-col>
      <el-col :xs="6" :sm="6" :lg="3" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('shoppings')">
          <div class="card-panel-icon-wrapper icon-chart">
            <svg-icon icon-class="chart" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">统计报表</div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>

export default {
  methods: {
    handleSetLineChartData(type) {
      this.$store.dispatch('app/checkTopMenu', type)
    }
  }
}
</script>

<style lang="scss" scoped>
  .panel-group {
    margin-top: 18px;

    .card-panel-col {
      margin-bottom: 32px;
    }

    .card-panel {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      height: 140px;
      cursor: pointer;
      font-size: 12px;
      position: relative;
      overflow: hidden;
      color: #666;
      background: #fff;
      box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
      border-color: rgba(0, 0, 0, .05);

      &:hover {
        .card-panel-icon-wrapper {
          color: #fff;
        }

        .icon-people {
          background: #40c9c6;
        }

        .icon-message {
          background: #36a3f7;
        }

        .icon-money {
          background: #f4516c;
        }

        .icon-shopping {
          background: #ff7300
        }

        .icon-setting {
          background: #f4516c;
        }
        .icon-purchase {
          background: #ff7300;
        }
        .icon-stock {
          background: #ffd700;
        }
        .icon-breed {
          background: #8ce600;
        }
        .icon-sales {
          background: #40c9c6;
        }
        .icon-teller {
          background: #36a3f7;
        }
        .icon-chart {
          background: #6633cc;
        }
      }

      .icon-people {
        color: #40c9c6;
      }

      .icon-message {
        color: #36a3f7;
      }

      .icon-money {
        color: #f4516c;
      }

      .icon-shopping {
        color: #ff7300
      }

      .icon-setting {
        color: #f4516c;
      }
      .icon-purchase {
        color: #ff7300;
      }
      .icon-stock {
        color: #ffd700;
      }
      .icon-breed {
        color: #8ce600;
      }
      .icon-sales {
        color: #40c9c6;
      }
      .icon-teller {
        color: #36a3f7;
      }
      .icon-chart {
        color: #6633cc;
      }

      .card-panel-icon-wrapper {
        float: left;
        padding: 16px;
        transition: all 0.38s ease-out;
        border-radius: 6px;
      }

      .card-panel-icon {
        float: left;
        font-size: 48px;
      }

      .card-panel-description {
        float: right;
        font-weight: bold;

        .card-panel-text {
          line-height: 18px;
          color: rgba(0, 0, 0, 0.45);
          font-size: 16px;
        }

        .card-panel-num {
          font-size: 20px;
        }
      }
    }
  }

  @media (max-width: 550px) {
    .card-panel-description {
      display: none;
    }

    .card-panel-icon-wrapper {
      float: none !important;
      width: 100%;
      height: 100%;
      margin: 0 !important;

      .svg-icon {
        display: block;
        margin: 14px auto !important;
        float: none !important;
      }
    }
  }
</style>
